package com.jwaoo.mobile.common.listener;

import android.content.Context;
import android.util.Log;

import com.dx.as.JWCache;
import com.dx.as.buriedpoint.bean.CrashInfo;
import com.dx.as.common.log.LogUtil;
import com.dx.as.db.IDBListener;
import com.dx.as.db.SqlLiteHelper;
import com.dx.as.utils.DateUtil;
import com.jwaoo.mobile.common.crash.CrashHandler;
import com.jwaoo.mobile.db.AppDatabase;

/**
 * Created by jwaoo on 2017/6/20.
 */

public class CrashHandlerLisener implements CrashHandler.ICrashHandlerLisener{
    @Override
    public void crashHanderCallBack(Context context, final Throwable ex) {
        LogUtil.e(CrashHandler.TAG,ex.toString(),ex);
//        SqlLiteHelper.getInstance(context).dbOption(AppDatabase.class,new IDBListener<AppDatabase>(){
//            @Override
//            public void onOption(AppDatabase database) {
//                if (ex != null){
//                    String crashBy = ex.toString();
//                    String content = CrashHandler.getInstance().getStackTrace(ex);
//                    long time = DateUtil.getGMTUnixTimeByCalendar();
//                    String uuid = JWCache.getAccount();
//                    CrashInfo crashInfo = new CrashInfo();
//                    crashInfo.setCaseBy(crashBy);
//                    crashInfo.setContent(content);
//                    crashInfo.setTime(time);
//                    crashInfo.setUuid(uuid);
//                    database.actionsDao().insertCrashInfo(crashInfo);
//                }
//            }
//        });
    }
}
